package com.example.common.core;

import lombok.Getter;

@Getter
public enum ResultCode {
    SUCCESS(200, "成功"),
    NO_CONTENT(204, "无内容"),

    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "未认证"),
    FORBIDDEN(403, "无权限"),
    NOT_FOUND(404, "未找到"),
    METHOD_NOT_ALLOWED(405, "方法不允许"),
    NOT_ACCEPTABLE(406, "请求头信息错误"),
    REQUEST_TIMEOUT(408, "请求超时"),
    UNSUPPORTED_MEDIA_TYPE(415, "不支持的媒体类型"),
    UNPROCESSABLE_ENTITY(422, "请求参数错误"),
    TOO_MANY_REQUESTS(429, "请求频率过快"),

    FAIL(500, "失败"),
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    SERVICE_UNAVAILABLE(503, "服务不可用"),
    GATEWAY_TIMEOUT(504, "网关超时"),
    UNKNOWN_ERROR(999, "未知错误"),

    QUERY_SUCCESS(1000, "查询成功"),
    QUERY_FAIL(1001, "查询失败"),
    QUERY_ERROR(1002, "查询异常"),
    QUERY_TIMEOUT(1003, "查询超时"),
    QUERY_EMPTY(1004, "查询结果为空"),

    ;

    private final int code;
    private final String message;

    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
}
